package com.itlong.cloud.push.message;

import org.jboss.netty.channel.Channel;

import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

/**
 * <desc>
 * 保存Channel对应类.
 * </desc>
 *
 * @createDate 2018/7/5
 */
public class GatewayService {

    private static Map<String, Channel> map = new ConcurrentHashMap<>();

    public static void addGatewayChannel(String id, Channel gateway_channel){
        map.put(id, gateway_channel);
    }

    public static Map<String, Channel> getChannels(){
        return map;
    }

    public static Channel getGatewayChannel(String id){
        return map.get(id);
    }

    public static void removeGatewayChannel(String id){
        map.remove(id);
    }
}